]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st-scroll-view-fade: Don't fade out gradient
authorAdel Gadllah <adel.gadllah@gmail.com>
Fri, 22 Mar 2013 16:19:26 +0000 (17:19 +0100)
committerAdel Gadllah <adel.gadllah@gmail.com>
Fri, 22 Mar 2013 18:56:13 +0000 (19:56 +0100)
The changes from commit b4f5f1e4617434 and b394d184cc7fa6 increased the
instructions required for the fade fragment shader. This is over the limit
for some hardware (like intel gen3), which causes the driver to fallback
to software rendering for the shader. The result is that painting a scrollview
that has a fade effect takes around 30 (!!) seconds.

So lets go back to the old effect for 3.8 until we find a solution.

https://bugzilla.gnome.org/show_bug.cgi?id=696404

src/st/st-scroll-view-fade.glsl

index 4324c00b763fc22f1517d60938062e30379dcfc1..0c76c5396949feec8baa7620ea1969564d9f2aab 100644 (file)
@@ -36,13 +36,6 @@ uniform float hvalue;
  */
 uniform mat2 fade_area;
 
-/*
- * Scale from [0.0, 1.0] to [1.0, 1.0]. Do this by
- * changing it to scaling [1.0, 0.0] to [0.0, 0.0]
- * and then transforming the end result.
- */
-#define FADE(gradient, factor) (1.0 - (1.0 - gradient) * factor)
-
 void main ()
 {
     cogl_color_out = cogl_color_in * texture2D (tex, vec2 (cogl_tex_coord_in[0].xy));
@@ -66,20 +59,20 @@ void main ()
 
         float vfade_scale = height / vfade_offset;
         if (fade_top) {
-            ratio *= FADE((y / vfade_offset), min(sqrt(vvalue) * vfade_scale, 1.0));
+            ratio *= y / vfade_offset;
         }
 
         if (fade_bottom) {
-            ratio *= FADE((fade_area[1][1] - y)/(fade_area[1][1] - fade_bottom_start), min(sqrt(1.0 - vvalue) * vfade_scale, 1.0));
+            ratio *= (fade_area[1][1] - y) / (fade_area[1][1] - fade_bottom_start);
         }
 
         float hfade_scale = width / hfade_offset;
         if (fade_left) {
-            ratio *= FADE(x / hfade_offset, min(sqrt(hvalue) * hfade_scale, 1.0));
+            ratio *= x / hfade_offset;
         }
 
         if (fade_right) {
-            ratio *= FADE((fade_area[1][0] - x)/(fade_area[1][0] - fade_right_start), min(sqrt(1.0 - hvalue) * hfade_scale, 1.0));
+            ratio *= (fade_area[1][0] - x) / (fade_area[1][0] - fade_right_start);
         }
 
         cogl_color_out *= ratio;